//
//  CouponAdd.m
//  OrgOnline
//
//  Created by kiko on 16/3/2.
//  Copyright © 2016年 kiko. All rights reserved.
//
#import "BlackThreeLabel.h"
#import "WhiteRoundField.h"
#import "CouponAdd.h"

@interface CouponAdd (){
    BlackThreeLabel *downLabel;
    BlackThreeLabel *priceLabel;
    UIButton *radioUp;
    UIButton *radioDiscount;
    UIImageView *imgSelecta;
    UIImageView *imgSelectb;
}

@end


@implementation CouponAdd

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor colorWithRed:241.0f/255.0f green:242.0f/255.0f blue:247.0f/255.0f alpha:1];
    self.title = @"添加优惠券";
    [self viewDidLoadBlue];
    [self configHeadRight];
    [self configContent];
}

-(void)configHeadRight{
    
    
    UIButton *rbut = [[UIButton alloc] initWithFrame:CGRectMake(swidth-70, 18, 27, 8)];
    UILabel *t=[[UILabel alloc] initWithFrame:CGRectMake(0, 0 ,27, 8)];
    t.text=@"保存";
    t.font=[UIFont systemFontOfSize:13];
    t.textColor=[UIColor whiteColor];
    [rbut addSubview:t];
    
    
    
   // [rbut addTarget:self action:@selector(couponAddSave) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *rightbtn = [[UIBarButtonItem alloc] initWithCustomView:rbut];
    self.navigationItem.rightBarButtonItem = rightbtn;
    
    
    
}


-(void)updiscountselect{
   NSLog(@"left");
    if([downLabel.text isEqual:@"打"]){
        imgSelectb.image=[UIImage imageNamed:@"notselect"];
        imgSelecta.image=[UIImage imageNamed:@"select"];
         downLabel.text=@"减";
        priceLabel.text=@"元";
    }

    
    
}
-(void)discountselect{
     NSLog(@"right");
    if([downLabel.text isEqual:@"减"]){
    downLabel.text=@"打";
    priceLabel.text=@"折";
    imgSelecta.image=[UIImage imageNamed:@"notselect"];
    imgSelectb.image=[UIImage imageNamed:@"select"];
    
    }
}

-(void)configContent{
    
    
    
    BlackThreeLabel *type=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(23,81, 80, 20)];
    type.text=@"优惠券类型：";
    [self.view addSubview:type];
    
    radioUp=[[UIButton alloc] initWithFrame:CGRectMake(110.5,81, 20, 20)];
    imgSelecta=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0 ,22,22)];
    imgSelecta.image=[UIImage imageNamed:@"select"];
    [radioUp addSubview:imgSelecta];
    [radioUp addTarget:self action:@selector(updiscountselect) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:radioUp];
    
    
    
    BlackThreeLabel *updiscount=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(140.5,81, 50, 20)];
    updiscount.text=@"满减";
    [self.view addSubview:updiscount];
    
    radioDiscount=[[UIButton alloc] initWithFrame:CGRectMake(210.5,81, 20, 20)];
    imgSelectb=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0 ,22,22)];
    imgSelectb.image=[UIImage imageNamed:@"notselect"];
    [radioDiscount addSubview:imgSelectb];
    [radioDiscount addTarget:self action:@selector(discountselect) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:radioDiscount];
    
    
    
    
    
    BlackThreeLabel *discount=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(240.5,81, 50, 20)];
    discount.text=@"折扣";
    [self.view addSubview:discount];
    
    BlackThreeLabel *up=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(84,125.5, 20, 20)];
    up.text=@"满";
    [self.view addSubview:up];
    
    WhiteRoundField *upprice=[[WhiteRoundField alloc] initWithFrame:CGRectMake(109.5, 116.5, 81, 40)];
    [self.view addSubview:upprice];
    
    BlackThreeLabel *price=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(195.5,125.5, 20, 20)];
    price.text=@"元";
    [self.view addSubview:price];
    
    
    
    
    downLabel=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(230.5,125.5, 20, 20)];
    downLabel.text=@"减";
    [self.view addSubview:downLabel];
    
    
    priceLabel=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(341.5,125.5, 20, 20)];
    priceLabel.text=@"元";
    [self.view addSubview:priceLabel];
    
    
    WhiteRoundField *downprice=[[WhiteRoundField alloc] initWithFrame:CGRectMake(255.5, 116.5, 81, 40)];
    [self.view addSubview:downprice];
    
    BlackThreeLabel *usetimes=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(35.5,180, 70, 20)];
    usetimes.text=@"使用次数：";
    [self.view addSubview:usetimes];
    
    WhiteRoundField *times=[[WhiteRoundField alloc] initWithFrame:CGRectMake(109, 172, 80.5, 40)];
    [self.view addSubview:times];
    
    BlackThreeLabel *pricec=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(194.5,180, 20, 20)];
    pricec.text=@"元";
    [self.view addSubview:pricec];
    
    BlackThreeLabel *infinite=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(259.5,180, 50, 20)];
    infinite.text=@"无限";
    [self.view addSubview:infinite];
    
    BlackThreeLabel *couponcode=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(10,235.5, 95, 20)];
    couponcode.text=@"优惠券使用码：";
    [self.view addSubview:couponcode];
    
    WhiteRoundField *codefield=[[WhiteRoundField alloc] initWithFrame:CGRectMake(108,227.5, swidth-131.5, 40)];
    [self.view addSubview:codefield];
    
    BlackThreeLabel *stime=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(35.5,291, 70, 20)];
    stime.text=@"开始时间：";
    [self.view addSubview:stime];
    
    WhiteRoundField *stimefield=[[WhiteRoundField alloc] initWithFrame:CGRectMake(108,283, swidth-131.5, 40)];
    [self.view addSubview:stimefield];
    
    BlackThreeLabel *etime=[[BlackThreeLabel alloc] initWithFrame:CGRectMake(35.5,346.5, 70, 20)];
    etime.text=@"结束时间：";
    [self.view addSubview:etime];
    
    WhiteRoundField *etimefield=[[WhiteRoundField alloc] initWithFrame:CGRectMake(108,338.5, swidth-131.5, 40)];
    [self.view addSubview:etimefield];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
 
 

*/

@end
